import tui from '../common/httpRequest'


// 登录获取token
export function login(data){
	return tui.requestNoAuth(
		"/social/weapp/login",
		"GET",
		data,
		false,
		true,
		true
	);
};

// 更新用户信息
export function setUserInfo(data){
	return tui.request(
		"/social/weapp/setUserInfo",
		"POST",
		data,
		false,
		true,
		true
	)
};

// 更新手机号码
export function updateMobile(data){
	return tui.request(
		"/social/weapp/updateMobile",
		"POST",
		data,
		false,
		true,
		true
	)
}

// 获取文章列表
export function getArticleList(data){
	return tui.request(
		"/article/getArticleList",
		"GET",
		data,
		false,
		true,
		true
	)
}

// 上传文章
export function addArticle(data){
	return tui.request(
		"/article/addArticle",
		"POST",
		data,
		false,
		true,
		true
	)
}

// 获取文章
export function getArticleById(data){
	return tui.request(
		"/article/getArticleById",
		"GET",
		data,
		false,
		true,
		true
	)
}

// 获取评论
export function getComment(data){
	return tui.request(
		"/shopcomment/getComment",
		"GET",
		data,
		false,
		true,
		true
	)
}

// 发表评论
export function setComment(data){
	return tui.request(
		"/shopcomment/setComment",
		"POST",
		data,
		false,
		true,
		true
	)
}

// 获取预约列表
export function getOrderList(data){
	return tui.request(
		"/shoporder/getOrderList",
		"GET",
		data,
		false,
		true,
		true
	)
}

// 添加预约
export function addOrder(data){
	return tui.request(
		"/shoporder/addOrder",
		"POST",
		data,
		false,
		true,
		true
	)
}

// 获取会员卡信息
export function getVipCardInfo(data){
	return tui.request(
		"/vipcard/getVipCardInfo",
		"GET",
		data,
		false,
		true,
		true
	)
}


// 充值
export function addDeposit(data){
	return tui.request(
		"/vipcarddeposit/addDeposit",
		"POST",
		data,
		false,
		true,
		true
	)
}

// 获取字典
export function getDictDataByType(type){
	return tui.request(
		"/dictData/getByType/" + type,
		"GET",
		{},
		false,
		true,
		true
	)
}

//点击喜欢
export function addArticleLike(data){
	return tui.request(
		"/shoparticlelike/addArticleLike",
		"POST",
		data,
		false,
		true,
		true
	)
}

//取消喜欢
export function removeArticleLike(data){
	return tui.request(
		"/shoparticlelike/removeArticleLike",
		"POST",
		data,
		false,
		true,
		true
	)
}

//注册会员卡
export function addVipCard(data){
	return tui.request(
		"/vipcard/addVipCard",
		"POST",
		data,
		false,
		true,
		true
	)
}


//收藏
export function addCollect(data){
	return tui.request(
		"/shoparticlecollect/addCollect",
		"POST",
		data,
		false,
		true,
		true
	)
}

//取消收藏
export function removeCollect(data){
	return tui.request(
		"/shoparticlecollect/removeCollect",
		"POST",
		data,
		false,
		true,
		true
	)
}

// 获取我的文章列表
export function getMyArticle(data){
	return tui.request(
		"/article/getMyArticle",
		"GET",
		data,
		false,
		true,
		true
	)
}

// 获取我的收藏列表
export function getMyCollect(data){
	return tui.request(
		"/article/getMyCollect",
		"GET",
		data,
		false,
		true,
		true
	)
}


// =================社区跑腿======================
// 创建订单信息
export function createOrder(data){
	return tui.request(
		"/cumorder/createOrder",
		"POST",
		data,
		false,
		false,
		true
	)
}

// 获取订单列表
export function getCumOrderList(data){
	return tui.request(
		"/cumorder/getOrderList",
		"GET",
		data,
		false,
		true,
		true
	)
}

// 接受订单
export function pickOrder(data){
	return tui.request(
		"/cumorder/pickOrder",
		"POST",
		data,
		false,
		true,
		true
	)
}

// 获取我的订单列表
export function myOrderList(data){
	return tui.request(
		"/cumorder/myOrderList",
		"GET",
		data,
		false,
		true,
		true
	)
}

// 获取地址列表
export function getMyAddress(data){
	return tui.request(
		"/cumaddress/getMyAddress",
		"GET",
		data,
		false,
		true,
		true
	)
}

// 添加、编辑地址
export function addOrEditAddress(data){
	return tui.request(
		"/cumaddress/addOrEditAddress",
		"POST",
		data,
		false,
		true,
		true
	)
}

// 删除地址
export function deleteAddress(data){
	return tui.request(
		"/cumaddress/delete",
		"POST",
		data,
		false,
		true,
		true
	)
}